home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 April / Chip CMCD0400.iso / SOFTWARE / Demo / InfoPulse / GateKeeper / gk3full.exe / data1.cab / ConfigSite_Files / accounts / useredit.agp < prev    next >
Encoding:
Text File  |  1999-06-17  |  7.4 KB  |  276 lines

  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  4. <meta NAME="Author,Design" Content="GateKeeper Team; gatekeeper@infopulse.net">
  5. <meta NAME="Copyright" Content="Infopulse; www.infopulse.net">
  6. <title>Empty</title>
  7. </head>
  8.  
  9. <body>
  10. <%
  11.     bValidPwd = True
  12.  
  13.     If Request.ReqParam("name") = "" Then
  14.         Set user = Accounts.Users.NewUser
  15.         NewUser = TRUE
  16.     Else
  17.         If Request.ReqParam("newuser") = "True" Then
  18.             Set user = Accounts.Users.NewUser
  19.             user.Name = Request.ReqParam("name")
  20.             NewUser = TRUE
  21.         Else
  22.             Set user = Accounts.Users.item(Request.ReqParam("name"))
  23.             NewUser = FALSE
  24.         End If
  25.     End If
  26.  
  27.     If Request.ReqParam("action") = "Remove" AND Not NewUser = TRUE Then
  28.         On Error Resume Next
  29.         user.Remove
  30.         If Not Err.Number = 0 Then 
  31.             ErrLine = Err.Description
  32.         Else
  33.             Response.Redirect("users.agp")
  34.         End If
  35.     ElseIf Request.ReqParam("action") = "Commit" Then
  36.         ' Process the user account
  37.         If Request.ReqParam("CanChangePwd") = "True" Then
  38.             user.CanChangePassword = TRUE
  39.         Else
  40.             user.CanChangePassword = FALSE
  41.         End If
  42.         If Request.ReqParam("MustChangePwd") = "True" Then
  43.             user.MustChangePassword = TRUE
  44.         Else
  45.             user.MustChangePassword = FALSE
  46.         End If
  47.         If Request.ReqParam("Enabled") = "True" Then
  48.             user.Enabled = TRUE
  49.         Else
  50.             user.Enabled = FALSE
  51.         End If
  52.         user.RealName = Request.ReqParam("realname")
  53.         user.Description = Request.ReqParam("description")
  54.         
  55.         sPwd = Request.ReqParam("password")
  56.         sTestPwd = Request.ReqParam("testPassword")
  57.         if sPwd <> sTestPwd Then
  58.             bValidPwd = False
  59.         Else
  60.             user.Password = sPwd
  61.         End If
  62.  
  63.         ' Process the grouplist
  64.         Dim grouplist()
  65.         groupline = Request.ReqParam("groups")
  66.         grouplistidx = 1
  67.         While Len(groupline)
  68.             pos = InStr(groupline,",")
  69.             If pos > 0 Then
  70.                 groupitem = Left(groupline,pos - 1)
  71.                 groupline = Mid(groupline,pos + 1)
  72.             Else
  73.                 groupitem = groupline
  74.                 groupline = ""
  75.             End If
  76.             ReDim Preserve grouplist(grouplistidx+1)
  77.             grouplist(grouplistidx) = groupitem
  78.             grouplistidx = grouplistidx + 1
  79.         Wend
  80.  
  81.         Set groups = Accounts.Groups
  82.         For groupcnt = 1 to groups.count
  83.             Set group = Accounts.Groups.Item(groupcnt)
  84.  
  85.             bIsMemberOfThisGroup = FALSE
  86.             For listcnt = 1 to grouplistidx-1
  87.                 If grouplist(listcnt) = group.name Then
  88.                     bIsMemberOfThisGroup = TRUE
  89.                 End If
  90.             Next
  91.  
  92.             If group.IsMember(user.name) AND Not bIsMemberOfThisGroup = TRUE Then
  93.                 group.DelMember(user.name)
  94.                 group.Commit
  95.             ElseIf Not group.IsMember(user.name) AND bIsMemberOfThisGroup = TRUE Then
  96.                 group.AddMember(user.name)
  97.                 group.Commit
  98.             End If
  99.  
  100.         Next
  101.  
  102.         if bValidPwd Then
  103.             On Error Resume Next
  104.             user.Commit
  105.             If Not Err.Number = 0 Then 
  106.                 ErrLine = Err.Description
  107.             Else
  108.                 Response.Redirect("users.agp")
  109.             End If
  110.         Else
  111. %>
  112.             <B><FONT COLOR="#FF0000">
  113.                 The password was not confirmed correctly !
  114.             </FONT></B>
  115.             <br>
  116. <%
  117.         End if
  118.     End If
  119.     If Not NewUser Then
  120. %>
  121.         <p><big><strong><font face="Arial">
  122.             Edit user account
  123.         </font></strong></big></p>
  124. <%
  125.     Else
  126. %>
  127.         <p><big><strong><font face="Arial">
  128.             Add new user account
  129.         </font></strong></big></p>
  130. <%
  131.     End If
  132.  
  133.     If Not Len(ErrLine) = 0 Then
  134.         Response.Write("<B><FONT COLOR=""#FF0000"">" & ErrLine & "</FONT></B><br>")
  135.     End If
  136. %>
  137.  
  138. <form method="POST" action="/accounts/useredit.agp">
  139.     <input type="hidden" name="newuser" value="<%Response.Write(NewUser)%>">
  140.     <div align="center"><center>
  141.     <table border="1" cellpadding="0" cellspacing="0" width="100%">
  142.         <tr>
  143.             <td width="40%" bgcolor="#183159"><strong><font face="Arial" color="#FFFFFF">
  144.                 Option
  145.             </font></strong></td>
  146.             <td width="40%" bgcolor="#183159"><strong><font face="Arial" color="#FFFFFF">
  147.                 Value
  148.             </font></strong></td>
  149.         </tr>
  150.         <tr>
  151.             <td width="40%" title="Fill in with logon names like: jsmith, john.doe, and so on."><strong><font face="Arial">
  152.                 User name
  153.             </font></strong></td>
  154.             <td width="40%">
  155. <%
  156.     If NewUser Then
  157. %>
  158.     <input type="text" size="20" name="name" value="<%Response.Write(user.name)%>">
  159. <%
  160.     Else
  161. %>
  162.     <input type="hidden" name="name" value="<%Response.Write(user.name)%>">
  163.     <%Response.Write(user.name)%>
  164. <%
  165.     End If
  166. %>
  167.             </td>
  168.         </tr>
  169.         <tr>
  170.             <td width="40%"><strong><font face="Arial">
  171.                 Password
  172.             </font></strong></td>
  173.             <td width="40%"><input type="password" size="20" name="password" value="<%Response.Write(user.password)%>"></td>
  174.         </tr>
  175.         <tr>
  176.             <td width="40%"><strong><font face="Arial">
  177.                 Confirm password
  178.             </font></strong></td>
  179.             <td width="40%"><input type="password" size="20" name="testPassword" value="<%Response.Write(user.password)%>"></td>
  180.         </tr>
  181.         <tr>
  182.             <td width="40%"><strong><font face="Arial">
  183.                 Full name
  184.             </font></strong></td>
  185.             <td width="40%"><input type="text" size="40" name="realname" value="<%Response.Write(user.realname)%>"></td>
  186.         </tr>
  187.         <tr>
  188.             <td width="40%"><strong><font face="Arial">
  189.                 Description
  190.             </font></strong></td>
  191.             <td width="40%"><input type="text" size="40" name="description" value="<%Response.Write(user.description)%>"></td>
  192.         </tr>
  193.         <tr>
  194.             <td width="40%" title="If the checkbox is unchecked the account cannot be used."><strong><font face="Arial">
  195.                 Enabled
  196.             </font></strong></td>
  197.             <td width="40%"><input type="checkbox" <% If user.Enabled Then Response.Write("Checked ") End If %> name="Enabled" value="True"></td>
  198.         </tr>
  199.         <tr>
  200.             <td width="40%"><strong><font face="Arial">
  201.                 The user can change the password
  202.             </font></strong></td>
  203.             <td width="40%"><input type="checkbox" <% If user.CanChangePassword Then Response.Write("Checked ") End If %> name="CanChangePwd" value="True"></td>
  204.         </tr>
  205.         <tr>
  206.             <td width="40%"><strong><font face="Arial">
  207.                 The user must change the password at next logon
  208.             </font></strong></td>
  209.             <td width="40%"><input type="checkbox" <% If user.MustChangePassword Then Response.Write("Checked ") End If %> name="MustChangePwd" value="True"></td>
  210.         </tr>
  211.     </table>
  212.     </center></div>
  213. <br>
  214. <font face="Arial">
  215. <%
  216.     Set groups = Accounts.Groups
  217.     groupcount = 1
  218.     if groups.count > 0 Then
  219.         if NewUser = TRUE Then
  220.             Response.Write("This user will be a member of the following groups:")
  221.         Else
  222.             Response.Write("This user is a member of the following groups:")
  223.         End If
  224. %>
  225.     <table border="0" width="100%">
  226. <%
  227.     End if
  228.     While Not groupcount > groups.count
  229. %>
  230.         <tr>
  231. <%
  232.         For subcount = 0 to 3 
  233. %>
  234.             <td width="25%">
  235. <%
  236.             If Not groupcount > groups.count Then
  237.                 Set group = groups.item(groupcount)
  238.                 Response.Write("<input type=""checkbox"" ")
  239.                 If group.IsMember(user.name) Then
  240.                     Response.Write("Checked ")
  241.                 End If
  242.                 if ( group.name = "Users" And NewUser = TRUE ) Then
  243.                     Response.Write("name=""groups"" value="""&group.name&""" checked>")
  244.                 Else
  245.                     Response.Write("name=""groups"" value="""&group.name&""">")
  246.                 End If
  247.                 Response.Write(group.name)
  248.             End If
  249.             groupcount = groupcount + 1
  250. %>
  251.             </td>
  252. <%
  253.         Next
  254. %>
  255.         </tr>
  256. <%
  257.     WEnd
  258. %>
  259.     </table>
  260.     <p><input type="submit" name="action" value="Commit">
  261. <% 
  262.     If Not NewUser = TRUE Then 
  263. %>
  264.     <input type="submit" name="action" value="Remove">
  265. <%
  266.     End If
  267. %>
  268.     </p>
  269. </form>
  270. </font>
  271. <p><br>
  272. <font size="1" face="Arial"><%Response.Write(GateKeeper.Version)%></font>
  273. </p>
  274. </body>
  275. </html>
  276.